#include <string>
#include <iostream>

using namespace std;

class node{
	public:
		node(string v, node* leftN, node* rightN){
			val = v;	
			left = leftN;
			right = rightN;
		}
		~node(){ }
	
		string val;
	
		node* left;
		node* right;
};

node* createNode(){
	node* n1 = new node("sister", 0, 0);
	node* n2 = new node("me", 0, 0);
	node* n3 = new node("cusin1", 0, 0);
	node* n4 = new node("cusin2", 0, 0);
	node* n5 = new node("dad", n1, n2);
	node* n6 = new node("uncle", n3, n4);
	node* n7 = new node("grandpa", n5, n6);

	return n7;
}


void dfs(node* n, string parent, string sItem){
	if(n->val == sItem){
		cout << parent + " -> " + sItem << endl;
	}else{
		if(n->left != 0) dfs(n->left,  parent + " -> " + n->val, sItem);
		if(n->right != 0) dfs(n->right ,  parent + " -> " + n->val, sItem);
	}
}



int main(){
	node* n = createNode();
	dfs(n, "", "cusin1");

	return 0;
}
